<include file="public@header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
	
			<li class="active" id="list"><a href="{:url('sit/index')}">场地</a></li>
			<li><a href="{:url('sit/addSite')}">添加</a></li>
			<!-- 	<li><a href="{:url('user/add')}">{:lang('ADMIN_USER_ADD')}</a></li> -->
		</ul>
		<form class="well form-inline margin-top-20" method="post" action="{:url('sit/index')}">
		
			场地名称:
			<input type="text" class="form-control" name="site_name" style="width: 120px;" value="{$site_name}" placeholder="请输入场地名">
			地址:
			<input type="text" class="form-control" name="address" style="width: 120px;" value="{$address}" placeholder="请输入地址">
			分类:
			<select class="form-control" name="site_type_id" style="width: 140px;">
				<option value='0'>全部</option>
				<volist name="site_type" id="vo">
				   <option value="{$vo.id}"<if condition="$site_type_id eq $vo['id']">selected</if>>{$vo.name}</option>
				</volist>
			</select> &nbsp;&nbsp;
			<input type="submit" class="btn btn-primary" value="搜索" />
			<a class="btn btn-danger" href="{:url('sit/index')}">清空</a>
		</form>
		<table class="table table-hover table-bordered">
			<thead>
				<tr>
					<th width="50">ID</th>
					<th>场地名</th>
					<th>所属</th>
					<th>类型</th>
					<th>单价</th>
					<th>电话</th>
					<th>容纳人数</th>
					<th>开放时间</th>
					<th>图片</th>
					<th>简介</th>
					<th>地址</th>
					<th width="130">操作</th>
				</tr>
			</thead>
			<tbody>
				<!-- 	<php>$user_statuses=array("0"=>lang('USER_STATUS_BLOCKED'),"1"=>lang('USER_STATUS_ACTIVATED'),"2"=>lang('USER_STATUS_UNVERIFIED'));</php> -->
				
				<foreach name="list" item="vo">
					<tr>
					    <php>$img_url=cmf_get_image_preview_url($vo['pic']);</php>
					    <input type="hidden" name="id" value="">
						<td>{$vo.id}</td>
						<td><a class="btn " href='{:url('sit/detailSite',array('id'=>$vo.id))}'>{$vo.site_name}</a></td>
						<td>{$vo.incubator_name}</td>
						<td><?php echo  get_cate_name(5,$vo['site_type_id']); ?></td>
						<td>{$vo.price}元/次</td>
						<td>{$vo.mobile}</td>
						<td>{$vo.people}</td>
						<td>{$vo.start_time}--{$vo.end_time}</td>
						<td>  <div><a href="{$img_url}"><img src="{$img_url}" style="width:70px;display:block;"/></a></div></td>
						<td>{$vo.site_sketch}</td>
						<td>{$vo.address}</td>
						<!-- <td>
							<if condition="$vo['status'] eq 0">
								禁用
								<else />
								可用
							</if>
						</td>
						<td>{$vo.address}</td>
						<td>{$vo.tel}</td> -->
						<td>
							<a class='edit' href='{:url('Sit/editSite',array('id'=>$vo.id))}'>编辑</a>
							|
							<a class='del' id="{$vo.id}">删除</a>
							<if condition="(session('role_id') eq 4) OR (session('super_role_id') elt 0)">
							|
							<if condition="$vo['is_audit'] eq 1">
							<!-- | -->
							<a class='add_audit' id="{$vo['id']}">添加审核</a>
							<else />
							
							<a class='add_cancel_audit' id="{$vo['id']}">取消审核</a>
							</if>
							</if>
						</td>


					</tr>
				</foreach>
			</tbody>
		</table>
		<div class="pagination">{$page}</div>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
</body>
</html>
<script>
	$(function(){

	})
	$(".del").click(
	    function(){
	    if(confirm("确认要删除吗")){
	    	    var id=$(this).attr("id");
	    	    $.post("{:url('delSite')}",
	    		{id:id},
	    		function(data,status){

	    			location.href="{:url('index')}";
	    		});
	    }
		
		
	    }
	);

$(".add_audit").click(function(){
		id=$(this).attr("id");
			if(confirm("是否确定增加审核预定？")){
				 $.post("{:url('Sit/audit_Site')}",{id:id,cancel:2},function(data,status){
				 
				 	alert('添加成功');	
				 	//$("input[name=deposit_price]").val('0.00');
				 	location.href="{:url('index')}";
				 })
			}
		
		   })	
	$(".add_cancel_audit").click(function(){
		id=$(this).attr("id");
			if(confirm("是否确定取消审核预定")){
				 $.post("{:url('Sit/audit_Site')}",{id:id,cancel:1},function(data,status){
				
				 	alert('取消成功');	
				 	//$("input[name=deposit_price]").val('0.00');
				 	location.href="{:url('index')}";
				 })
			}
		
		   })	

</script>